//
//  ProductDetailsView.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/12/17.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class ProductDetailsView: UIView {
    
    fileprivate let grayView = UIView()
    fileprivate let titleLabel = UILabel()
    fileprivate let redView = UIView()
    fileprivate let lineView = UIView()

    init() {
        super.init(frame: .zero)
        
        grayView.backgroundColor = UIColor.mineColor()
        self.addSubview(grayView)
        
        redView.backgroundColor = UIColor.red
        redView.layer.cornerRadius = RATIO(maxNum: 2)
        redView.layer.masksToBounds = true
        self.addSubview(redView)
        
        titleLabel.text = productDetails
        titleLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 18))
        self.addSubview(titleLabel)
        
        lineView.backgroundColor = UIColor.lineColor()
        self.addSubview(lineView)
        
        grayView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.right.equalToSuperview()
            make.height.equalTo(RATIO_H(maxNum: 10))
        }
        
        redView.snp.makeConstraints { (make) in
            make.top.equalTo(grayView.snp.bottom).offset(RATIO_H(maxNum: 10))
            make.left.equalTo(RATIO(maxNum: 10))
            make.width.equalTo(RATIO(maxNum: 4))
            make.height.equalTo(RATIO_H(maxNum: 20))
        }
        
        titleLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(redView)
            make.left.equalTo(redView.snp.right).offset(RATIO(maxNum: 5))
            make.width.greaterThanOrEqualTo(10)
            make.height.greaterThanOrEqualTo(10)
        }
        
        lineView.snp.makeConstraints { (make) in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(1)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

}
